function validate(form){
    with(form){
	var numselected = 0;

	for (i = 0; i < numchoices.value; i++) {
	    var choice = document.getElementsByName("choice["+i+"]");
	    if (choice[0].checked == true)
		numselected++;
	}

	if (maxselect.value > 0 && numselected > maxselect.value) {
	    alert("You cannot check more than " + maxselect.value + " option(s).");
	    return false;
	}

	if (name.value==null || name.value==""){
	    alert("Please enter your name.");
	    name.focus();
	    return false;
	}
    }
}
